#pragma once

#include "CoreMinimal.h"
#include "GameFramework/Character.h"
#include "DemoCharacter.generated.h"

class UGameHUD;
class UNiagaraSystem;
class UNiagaraComponent;
class UDamageComponent;
class UCameraComponent;
class USpringArmComponent;

UCLASS()
class ADemoCharacter : public ACharacter
{
	GENERATED_BODY()

public:
	ADemoCharacter();

	virtual void BeginPlay() override;

	virtual void Tick(float DeltaTime) override;

	void PlayAttackSound();

	void PlayAttackEffect();

	UFUNCTION(BlueprintCallable)
	void ShowHUD();

	void PlayDamageHUD();

protected:
	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "通用组件", DisplayName = "摄像机摇臂")
	TObjectPtr<USpringArmComponent> SpringArmComponent;

	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "通用组件", DisplayName = "摄像机")
	TObjectPtr<UCameraComponent> CameraComponent;

	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "通用组件", DisplayName = "伤害组件")
	TObjectPtr<UDamageComponent> DamageComponent;

	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "通用组件", DisplayName = "音频组件")
	TObjectPtr<UAudioComponent> AudioComponent;

	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "通用组件", DisplayName = "特效组件")
	TObjectPtr<UNiagaraComponent> NiagaraComponent;

	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "通用组件", DisplayName = "伤害音效")
	TObjectPtr<USoundBase> AttackSound;

	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "通用组件", DisplayName = "伤害特效")
	TObjectPtr<UNiagaraSystem> AttackEffect;

	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "通用设置", DisplayName = "GameHUD模板")
	TSubclassOf<UGameHUD> GameHUDSubclassOf;

	UPROPERTY(VisibleInstanceOnly, BlueprintReadWrite, Category = "内部设置", DisplayName = "GameHUD")
	TObjectPtr<UGameHUD> GameHUD;

	UFUNCTION()
	void OnDeath();
};
